package org.example.mapper;

import org.apache.ibatis.annotations.*;
import org.example.pojo.admindto.SaleTableDTO;
import org.example.pojo.adminvo.SaleTableVO;
import org.example.pojo.entity.Goods;
import org.example.pojo.entity.SaleLog;

import java.util.List;

@Mapper
public interface GoodsMapper {
    public List<Goods> list(String name,double price1,double price2,int depart);
    public List<Goods> adminlist(String name,Integer salenum);
    public List<SaleTableVO> saletable(SaleTableDTO saleTableDTO);
    @Select("SELECT * FROM goods where id = #{id}")
    public Goods findById(Long id);
    @Insert("insert into goods(name, description, price, inventory, salenum) " +
            "values (#{name}, #{description}, #{price}, #{inventory}, #{salenum})")
    public void insert(Goods goods);
    public void update(Goods goods);
    @Delete("delete from goods where id = #{id}")
    public void deleteById(Long id);
    @Update("update goods set salenum = #{salenum} where id = #{id}")
    public void sell(Goods goods);
    @Update("update goods set salenum = #{salenum} where id = #{id}")
    public void cancel(Goods goods);
}